<?php

class ThemeController extends Controller
{
	private $themes = array();
	public function actionIndex()
	{
		//echo Yii::app()->modulePath;
		//$modulesListRaw = scandir(Yii::app()->modulePath, 1);
		//print_r(Yii::app()->theme);
		//die(Yii::app()->basePath.DIRECTORY_SEPARATOR.'themes');
		
		$themeDir  = opendir(Yii::app()->basePath.DIRECTORY_SEPARATOR.'themes');
		
		while (false !== ($filename = readdir($themeDir))) {
			$itemPath = Yii::app()->basePath.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.$filename;
			if(is_dir($itemPath) && file_exists($itemPath.DIRECTORY_SEPARATOR.$filename.'.info')){
				$themeInfo = parse_ini_file($itemPath.DIRECTORY_SEPARATOR.$filename.'.info');
				
				$this->themes[$filename] = $themeInfo;
				
			}
		}
		print_r($this->themes);
		//foreach
		$this->render('index');
	}
}